package com.iter.devbox.util;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class MyMapEntry {

	public static void main(String[] args) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("key1", "张三");
		map.put("key2", "李四");
		
		Set<Map.Entry<String, String>> set = map.entrySet();
		Iterator<Map.Entry<String, String>> it = set.iterator();
		
		for (Iterator<Map.Entry<String, String>> iter = map.entrySet().iterator(); iter.hasNext();) {
			Map.Entry<String, String> entry = iter.next();
			System.out.println(entry.getKey());
			System.out.println(entry.getValue());
		}
		while (it.hasNext()) {
			Map.Entry<String, String> mapEntry = it.next();
			System.out.println(mapEntry.getKey());
			System.out.println(mapEntry.getValue());
		}
		//for循环此种语法
		for (String i="1"; true;) {
			System.out.println(i);
		}
	}
}
